# 阶梯水价计算水费

sy=eval(input("输入上月水表吨数"))
by=eval(input("输入本月水表吨数"))
rs=eval(input("输入家庭人数"))
db=input("是否低保(y/n)")

if db == 'y':
    sl = by - sy - 6
else:
    sl = by - sy
sf = 0
if sl >= 0:
    if rs < 5:
        if sl <= 15:
            sf = sl * 2.58
        elif sl <= 22:
            sf = 2.58 * 15 + 3.34 * (sl - 15)
        else:
            sf = 2.58 * 15 + 3.34 * 7 + 4.09 * (sl - 22)
    else:
        if (sl / rs) <= 4:
            sf = sl * 2.58
        if (sl / rs) <= 5:
            sf = (rs * 4) * 2.58 + (sl - rs * 4) * 3.34
        if (sl / rs) > 5:
            sf = (rs * 4) * 2.58 + rs * 3.34 + (sl - rs * 5) * 4.09

print("{:.2f}  {:.2f}".format(sl, sf))